<?php
namespace common\services\common;

use common\services\BaseService;
use Yii;

class EmailService extends BaseService{
    /**
     * @param $sendToAddress
     * @param $subject
     * @param $template
     * @param $params
     * @param $cc
     * @return bool
     */
    public static function sendEMail($sendToAddress, $subject, $template, $params, $cc){
        $mail = Yii::$app->mailer->compose([
            'html' => $template . '-html',
            'text' => $template . '-text',
        ], $params);

        $mail->setTo($sendToAddress);
        $mail->setCc($cc);
        $mail->setSubject($subject);

        return $mail->send();
    }
}